import { createRouter, createWebHashHistory } from 'vue-router'
import { CustomRouteRecordRaw } from '@/types/router'

import DesignRoute from './modules/design'
import AlbumRoute from './modules/album'
import PatternRoute from './modules/pattern'
import CreateRoute from './modules/create'

export const constantRoutes: Array<CustomRouteRecordRaw> = [
  {
    path: '/login',
    component: () => import('@/views/user/Login.vue'),
    hidden: true,
    meta: {
      verification: false
    }
  }
]

export const asyncRoutes: Array<CustomRouteRecordRaw> = [
  ...DesignRoute,
  ...AlbumRoute,
  ...PatternRoute,
  ...CreateRoute
]

const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes,
  strict: true,
  scrollBehavior: () => ({ left: 0, top: 0 })
})

export default router
